import { defineStore } from 'pinia'
import { post_IntradayMovementStrategy } from '@/api/backtestApi'

export const useBacktestStore = defineStore('backtestStore', () => {
  const strategyList = ref([
    {
      strategy: 'IntradayMovementStrategy',
      name: '日内动量策略',
    },
  ])
  // 参数映射：策略 → 参数数组
  const strategyParamsMap = ref<Record<string, { key: string, label: string, value: string }[]>>({
    日内动量策略: [
      { key: 'period', label: '周期', value: '' },
    ],
    动量策略: [
      { key: 'momentum_window', label: '动量窗口', value: '' },
      { key: 'threshold', label: '阈值', value: '' },
    ],
  })
  // 策略对应的api
  const strategyApiMap = ref<Record<string, Function>>({
    日内动量策略: post_IntradayMovementStrategy,
  })

  return {
    strategyList,
    strategyParamsMap,
    strategyApiMap,
  }
})
